<template>
  <div class="sun-wrap">
    <h3>我是孙组件 {{ name }}----{{ price }}</h3>
  </div>
</template>

<script>
import { inject, toRefs } from 'vue';

export default {
  name: 'Sun',
  setup() {
    // 接收爷组件传递过来的数据
    const car = inject('car');

    return {
      ...toRefs(car)
    };
  }
};
</script>

<style lang="scss" scoped>
.sun-wrap {
  background-color: orange;
  padding: 30px;
}
</style>
